package com.etongwl.customprogressbar;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

public class MainActivity extends Activity {
	CustomProgressBar progress = null;
	int progressNum=0;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		progress = (CustomProgressBar) findViewById(R.id.progress_view);
		Thread thread = new Thread() {
			@Override
			public void run() {
				while (progressNum<90) {
					progressNum++;
					runOnUiThread(new Runnable() {
						
						@Override
						public void run() {
							progress.setProgress(progressNum);
						}
					});
					
					try {
						Thread.currentThread();
						Thread.sleep(100);
					} catch (InterruptedException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					}
				}
			}
		};
		thread.start();
	}

}
